package cn.tedu.csmall.product.webapi.controller;

import cn.tedu.csmall.pojo.entity.Goods;
import cn.tedu.csmall.pojo.entity.PmsSpu;
import cn.tedu.csmall.product.webapi.service.IGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Kiven
 */
@RestController
@RequestMapping("/goods")
public class GoodsController {

    @Autowired
    private IGoodsService goodsService;

    /**
     * 根据前端传的内容去查到该产品的商品详情
     * 返回的内容是spu+sku的集合
     * @return
     */
    @GetMapping("/spu")
    public List<Goods> getGoods(PmsSpu spu){
      return  goodsService.findGoods(spu);
    }

}
